home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-11-08 | 3.5 KB | 128 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWGrowBx.cpp
- // Release Version: $ 1.0d11 $
- //
- // Copyright: © 1995 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWFrameW.hpp"
-
- #ifndef FWGROWBX_H
- #include "FWGrowBx.h"
- #endif
-
- #ifndef FWFRAME_H
- #include "FWFrame.h"
- #endif
-
- #ifndef FWSCLBAR_H
- #include "FWSclBar.h"
- #endif
-
- #ifndef FWEVENT_H
- #include "FWEvent.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef SOM_ODFacet_xh
- #include <Facet.xh>
- #endif
-
- #ifndef SOM_ODWindow_xh
- #include <Window.xh>
- #endif
-
- //========================================================================================
- // Runtime Informations
- //========================================================================================
-
- #if FW_LIB_EXPORT_PRAGMAS
- #pragma lib_export on
- #endif
-
- #ifdef FW_BUILD_MAC
- #pragma segment fwgadgts
- #endif
-
- FW_DEFINE_CLASS_M1(FW_CGrowBox, FW_CGadget)
-
- //========================================================================================
- // CLASS FW_CGrowBox
- //========================================================================================
-
- //----------------------------------------------------------------------------------------
- // FW_CGrowBox::FW_CGrowBox
- //----------------------------------------------------------------------------------------
-
- FW_CGrowBox::FW_CGrowBox(Environment* ev,
- FW_CView* container, ODID id,
- const FW_CPoint& location) :
- FW_CGadget(ev, container, id, FW_CRect(location, FW_kFixed0,FW_kFixed0))
- {
- SetSize(ev, FW_CScrollBar::GetDefaultScrollBarSize());
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CGrowBox::~FW_CGrowBox
- //----------------------------------------------------------------------------------------
-
- FW_CGrowBox::~FW_CGrowBox()
- {
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CGrowBox::Draw
- //----------------------------------------------------------------------------------------
-
- void FW_CGrowBox::Draw(Environment* ev, ODFacet* facet, ODShape* invalidShape)
- {
- #ifdef FW_BUILD_MAC
- FW_CAcquiredODWindow aqODWindow = facet->GetFrame(ev)->AcquireWindow(ev);
- FW_ASSERT((ODWindow*)aqODWindow);
- ODPlatformWindow window = aqODWindow->GetPlatformWindow(ev);
-
-
- Rect portRect = window->portRect;
- FW_CPoint sbSize = FW_CScrollBar::GetDefaultScrollBarSize();
- FW_CPoint location = GetLocation(ev) + sbSize;
- if (location == FW_CPoint(FW_IntToFixed(portRect.right), FW_IntToFixed(portRect.bottom)))
- ::DrawGrowIcon(window);
- else
- {
- GrafPtr curPort;
- ::GetPort(&curPort);
-
- ::SetPort(window);
- ::PortSize(location.x.AsInt(), location.y.AsInt());
-
- ::DrawGrowIcon(window);
-
- ::SetPort(window); //just to be sure
- ::PortSize(portRect.right - portRect.left, portRect.bottom - portRect.top);
-
- ::SetPort(curPort);
- }
-
- #endif
- }
-
- //----------------------------------------------------------------------------------------
- // FW_CGrowBox::DoActivateEvent
- //----------------------------------------------------------------------------------------
-
- FW_Boolean FW_CGrowBox::DoActivateEvent(Environment *ev,
- const FW_CActivateEvent& theActivateEvent)
- {
- #ifdef FW_BUILD_MAC
- ODFacet* facet = theActivateEvent.GetFacet(ev);
-
- // we simply draw the grow box again (DrawGrowIcon takes care of the activate state)
- Draw(ev, facet, NULL);
- #endif
- return FALSE; // let other views handle activate events
- }
-
-